import request from '../utils/request'

// 用户API
export const userApi = {
  // 获取所有用户
  getUsers() {
    return request.get('/users')
  },
  
  // 根据ID获取用户
  getUserById(id) {
    return request.get(`/users/${id}`)
  },
  
  // 创建用户
  createUser(userData) {
    return request.post('/users', userData)
  },
  
  // 更新用户
  updateUser(id, userData) {
    return request.put(`/users/${id}`, userData)
  },
  
  // 删除用户
  deleteUser(id) {
    return request.delete(`/users/${id}`)
  },
  
  // 用户登录
  login(username, password) {
    return request.post('/users/login', { username, password })
  }
}

export default userApi


